package com.huaiwei.usmManager.modules.usm.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaiwei.usmManager.common.utils.PageUtils;
import com.huaiwei.usmManager.common.utils.Query;
import com.huaiwei.usmManager.modules.usm.dao.TypeDao;
import com.huaiwei.usmManager.modules.usm.entity.TypeEntity;
import com.huaiwei.usmManager.modules.usm.service.TypeService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

@Service
@Transactional
public class TypeServiceImpl extends ServiceImpl<TypeDao, TypeEntity> implements TypeService {

    @Override
    public PageUtils getPage(Map<String, Object> params) {
        String name= (String) params.get("name");
        IPage<TypeEntity> page =this.page(new Query<TypeEntity>().getPage(params),new QueryWrapper<TypeEntity>().like(StringUtils.isNotEmpty(name),"name",name));
        return new PageUtils(page);
    }
}
